var xmlhttp;
//var carrega=new Array();
//var carregando=1;
//var tempo;
function criaObjeto()
{
	try{
		xmlhttp = new XMLHttpRequest();
	}catch(ee){
		try{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				xmlhttp = false;
			}
		}
	}
}
function executaScript(val){
	var objScript = document.createElement("script");
	ini = val.indexOf('<script>');
	fim = val.indexOf('</script>', ini);
	codigo = val.substring(ini+8,fim);
	objScript.text = codigo;
	document.body.appendChild(objScript);
}

function carregaConteudo(nomediv,pagina,debug)
{
//	carregando=0;
	criaObjeto();
	document.getElementById(nomediv).innerHTML = "<img src=\"../images/load1.gif\" style=\"margin: 28 0 0 50%;\" />";
	xmlhttp.open('GET', pagina, true);
	xmlhttp.onreadystatechange=function() {
		if (xmlhttp.readyState==4){
			if(xmlhttp.status==200){
		  		string = xmlhttp.responseText;
		  		string = string.replace(/\+/g," ");
			  	string = unescape(string);
			  	if(debug){alert(string);}
			  	if(string.indexOf('<script>')!=-1) executaScript(string);
				document.getElementById(nomediv).innerHTML = string;
			}
		}
	}
	xmlhttp.send(null);
//	carregando=1;
}

/*
function carregaVarios(){
	if(carrega.length>0){
		if(carregando==1&&document.onload){
			sep=carrega[carrega.length-1].split('||');
			setTimeout("carregaConteudo('"+sep[0]+"','"+sep[1]+"')",100);
			carrega.pop();
			clearInterval(tempo);
			tempo=setInterval("carregaVarios()",200);
		}
	}
}
*/